home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / faq-s.zip / CHATSTUF.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-16  |  59KB  |  2,443 lines

  1. {$R-,S-,I-,D-,F+,V-,B-,N-,L+ }
  2. {$M 65500,0,0 }
  3.  
  4. unit chatstuf;
  5.  
  6. interface
  7.  
  8. uses crt,dos,
  9.      gentypes,gensubs,subs1,userret,flags,mainr1,modem,windows,statret,
  10.      configrt;
  11.  
  12. function specialcommand:boolean;
  13. procedure specialseries;
  14. procedure chat1 (gotospecial:boolean);
  15. procedure chat2 (gotospecial:boolean);
  16.  
  17. implementation
  18.  
  19. const c1=15;
  20.       c2=12;
  21.       c3=15;
  22.       c4=11;
  23.       w2=24;
  24.       w3=42;
  25.       axis1=9;
  26.       axis2=10;
  27.       edituser:array [1..12] of string=
  28.        ('┬───────────────────┬',
  29.         '│ User Name         │',
  30.         '│ User Level        │',
  31.         '│ Xfer Level        │',
  32.         '│ Xfer Points       │',
  33.         '│ User Note         │',
  34.         '│ Time Left         │',
  35.         '│ Password          │',
  36.         '│ G-File Level      │',
  37.         '│ Board Access      │',
  38.         '│ Sysop Access      │',
  39.         '└───────────────────┘');
  40.       utils:array [1..12] of string=
  41.        ('┬───────────────────┬',
  42.         '│ Hang up on User   │',
  43.         '│ Delete User       │',
  44.         '│ Snoop Mode [On]   │',
  45.         '│ Snoop Mode [Off]  │',
  46.         '└───────────────────┘',
  47.         '',
  48.         '',
  49.         '',
  50.         '',
  51.         '',
  52.         '');
  53.       extra:array [1..12] of string=
  54.        ('┬───────────────────────────┬',
  55.         '│ Drop to DOS (part memory) │',
  56.         '│ Run Setup Program         │',
  57.         '│ Run User Editor           │',
  58.         '│ Run Text Editor           │',
  59.         '│ Run ANSI Editor           │',
  60.         '└───────────────────────────┘',
  61.         '',
  62.         '',
  63.         '',
  64.         '',
  65.         '');
  66.  
  67. var dscinc:array [1..6] of array [1..60] of word;
  68.     Status:word;
  69. type brdrrec = record
  70.                 TL,TH,TR,LV,RV,BL,BH,BR:char;
  71.                end;
  72.  
  73. const border:brdrrec = (TL:'┌';TH:'─';TR:'┐';
  74.                         LV:'│';       RV:'│';
  75.                         BL:'└';BH:'─';BR:'┘');
  76.  
  77. {function specialcommand:boolean;
  78.  
  79.   function getstring (t:anystr):anystr;
  80.   var mm,lz:anystr;
  81.   begin
  82.     textbackground (0);
  83.     textcolor (15);
  84.     gotoxy (axis1+3,axis2+2);
  85.     write (usr,t);
  86.     readline (mm);
  87.     getstring:=mm;
  88.   end;
  89.  
  90.   function getint (t:lstr):integer;
  91.   var s:sstr;
  92.   begin
  93.     s:=getstring (t);
  94.     getint:=valu(s)
  95.   end;
  96.  
  97.   function getboo (t:lstr):boolean;
  98.   var s:sstr;
  99.   begin
  100.     s:=getstring (t);
  101.     getboo:=upcase(s[1])='Y'
  102.   end;
  103.  
  104.  procedure box;
  105.  
  106.   (* procedure qbox (row,col,rows,cols:byte;wndwattr,brdrattr:integer;brdr:brdrrec);
  107.    begin
  108.     if (rows>=2) and (cols>=2) then
  109.     begin
  110.       with brdr do
  111.       begin
  112.         qwrite    (row       ,col                     ,brdrattr,TL);
  113.         qfilleos  (                           1,cols-2,brdrattr,TH);
  114.         qwriteeos (                                    brdrattr,TR);
  115.         qfill     (row+1     ,col       ,rows-2,1     ,brdrattr,LV);
  116.         qfill     (row+1     ,col+cols-1,rows-2,1     ,brdrattr,RV);
  117.         qwrite    (row+rows-1,col                     ,brdrattr,BL);
  118.         qfilleos  (                           1,cols-2,brdrattr,BH);
  119.         qwriteeos (                                    brdrattr,BR);
  120.         qfill     (row+1     ,col+1     ,rows-2,cols-2,wndwattr,' ')
  121.      end;
  122.     end;
  123.    end; *)
  124.  
  125.   begin
  126.   (* qstoretomem (axis1,axis2,6,60,dscinc);
  127.    qbox (axis1,axis2,6,60,15,9,border); *)
  128.   end;
  129.  
  130.   procedure done1;
  131.   begin
  132.   (* qstoretoscr (axis1,axis2,6,60,dscinc); *)
  133.   end;
  134.  
  135.   procedure write1 (l:lstr);
  136.   begin
  137.    gotoxy (axis1+3,axis2+1);
  138.    textcolor (15);
  139.    textbackground (0);
  140.    writeln (usr,l);
  141.   end;
  142.  
  143.   procedure getnewtime;
  144.   var q:integer;
  145.       n:integer;
  146.   begin
  147.     n:=timeleft;
  148.     box;
  149.     write1 ('The user has '+strr(n)+' minutes left.');
  150.     q:=getint ('New time left for today? ');
  151.     if q>0 then begin
  152.       urec.timetoday:=urec.timetoday+(q-n);
  153.       writeurec;
  154.       writeln ('You have been granted '+strr(timeleft)+' minutes for today.')
  155.     end;
  156.   end;
  157.  
  158.   procedure getnewlevel;
  159.   var q,n:integer;
  160.   begin
  161.     box;
  162.     write1 ('Current Level: '+strr(ulvl));
  163.     q:=getint ('New Level [-1 to TRASH]: ');
  164.     if q>0 then begin
  165.      n:=q;
  166.      ulvl:=n;
  167.      urec.level:=n;
  168.      writeurec;
  169.      writeln ('You have been granted Level ',n,' access.');
  170.      if n=-1 then writeln ('That means you''ve been thrown off this system. Hahah.')
  171.     end
  172.   end;
  173.  
  174.   procedure getnewgflevel;
  175.   var q,n:integer;
  176.   begin
  177.     box;
  178.     write1 ('Current G-File Level: '+strr(urec.gflevel));
  179.     q:=getint ('New G-File Level: ');
  180.     if q>0 then begin
  181.      n:=q;
  182.      urec.gflevel:=n;
  183.      writeurec;
  184.      writeln ('You have been granted Level ',n,' G-File access.');
  185.     end
  186.   end;
  187.  
  188.   procedure getnewaccess;
  189.   var q,bname:sstr;
  190.       bn:integer;
  191.       ac:accesstype;
  192.       wasopen:boolean;
  193.       k:char;
  194.  
  195.     function inputaccess (q:sstr):accesstype;
  196.     begin
  197.       inputaccess:=invalid;
  198.       if length(q)=0 then exit;
  199.       case upcase(q[1]) of
  200.         'L':inputaccess:=letin;
  201.         'B':inputaccess:=bylevel;
  202.         'K':inputaccess:=keepout
  203.       end
  204.     end;
  205.  
  206.     procedure getallaccess;
  207.  
  208.       procedure setallaccess (ac:accesstype);
  209.       var cnt:integer;
  210.       begin
  211.         setalluserflags (urec,ac);
  212.         writeln ('Your access to all sub-boards: ',accessstr[ac]);
  213.         writeurec
  214.       end;
  215.  
  216.     begin
  217.       buflen:=1;
  218.       q:=getstring ('ALL acc. ([B]y level, [L]et in, [K]eep out, or CR): ');
  219.       ac:=inputaccess(q);
  220.       if ac<>invalid then setallaccess(ac)
  221.     end;
  222.  
  223.   var bd:boardrec;
  224.   begin
  225.     box;
  226.     write1 ('Change Sub-Board Access');
  227.     buflen:=10;
  228.     bname:=getstring ('Which sub-board to change access for [''*''/All]: ');
  229.     if length(bname)<1 then exit;
  230.     if bname='*' then
  231.       begin
  232.         getallaccess;
  233.         exit
  234.       end;
  235.     opentempbdfile;
  236.     bn:=searchboard(bname);
  237.     if bn=-1 then
  238.       begin
  239.         closetempbdfile;
  240.         write1 ('No such board!  Press any key..');
  241.         k:=bioskey;
  242.         exit
  243.       end;
  244.     write1 ('Board '+bname+'... Current access: '+accessstr[getuseraccflag(urec,bn)]);
  245.     buflen:=1;
  246.     q:=getstring ('Access ([B]y level, [L]et in, [K]eep out, or [CR]: ');
  247.     ac:=inputaccess(q);
  248.     if ac=invalid then begin
  249.       closetempbdfile;
  250.       exit
  251.     end;
  252.     setuseraccflag (urec,bn,ac);
  253.     writeurec;
  254.     closetempbdfile;
  255.     writeln ('New access for sub-board ',bname,': ',accessstr[ac])
  256.   end;
  257.  
  258.   procedure hangupyn;
  259.   var q:sstr;
  260.   begin
  261.     box;
  262.     write1 ('Hang up on User');
  263.     q:=getstring ('Hang up on him? [y/n]: ');
  264.     if length(q)>0 then if upcase(q[1])='Y' then
  265.       begin
  266.         writeln (unam,' the System is going down.'^M^M);
  267.         hangup;
  268.         forcehangup:=true;
  269.         specialcommand:=true
  270.       end
  271.   end;
  272.  
  273.   procedure getnewname;
  274.   var m:mstr;
  275.       n:integer;
  276.       t:string[1];
  277.   begin
  278.     box;
  279.     write1 ('Current Name: '+unam);
  280.     m:=getstring ('New User Name: ');
  281.     if length(m)<>0 then begin
  282.       n:=lookupuser(m);
  283.       if n<>0 then begin
  284.         buflen:=1;
  285.         t:=getstring ('Name already exists!  Are you sure? ');
  286.         if upcase(t[1])<>'Y' then exit
  287.       end;
  288.       unam:=m;
  289.       urec.handle:=m;
  290.       writeurec;
  291.       writeln ('Your Name has been changed to ',unam,'.')
  292.     end
  293.   end;
  294.  
  295.   procedure getnewpassword;
  296.   var m:mstr;
  297.   begin
  298.     box;
  299.     write1 ('Current Password: '+urec.password);
  300.     m:=getstring ('New Password: ');
  301.     if length(m)<>0 then
  302.     begin
  303.       urec.password:=m;
  304.       writeurec;
  305.       writeln ('Your Password has been changed.')
  306.     end
  307.   end;
  308.  
  309.   procedure getxferlevel;
  310.   var i:integer;
  311.   begin
  312.     box;
  313.      write1 ('Current Xfer Level: '+strr(urec.udlevel));
  314.      i:=getint ('New File Xfer Level: ');
  315.      if i<0 then exit
  316.       else begin
  317.        writeln ('You have been granted Level ',i,' File Xfer access.');
  318.        urec.udlevel:=i;
  319.        writeurec;
  320.       end;
  321.   end;
  322.  
  323.   procedure getxferpoints;
  324.   var i:integer;
  325.   begin
  326.    box;
  327.     write1 ('Current Xfer Points: '+strr(urec.udpoints));
  328.     i:=getint ('New File Xfer Points: ');
  329.      if i<0 then exit
  330.       else begin
  331.        writeln ('You have been granted ',i,' File Xfer points.');
  332.        urec.udpoints:=i;
  333.        writeurec;
  334.       end;
  335.   end;
  336.  
  337.   procedure snoopmode;
  338.   begin
  339.     box;
  340.     write1 ('All I/O to the modem is locked.');
  341.     delay (500);
  342.     modeminlock:=true;
  343.     setoutlock (true)
  344.   end;
  345.  
  346.   procedure unsnoop;
  347.   begin
  348.     box;
  349.     write1 ('All I/O to the modem is re-enabled.');
  350.     delay (500);
  351.     modeminlock:=false;
  352.     setoutlock (false)
  353.   end;
  354.  
  355.   procedure makenote;
  356.   var mastermind:mstr;
  357.   begin
  358.    box;
  359.    write1 ('Current Note: '+urec.note);
  360.    buflen:=30;
  361.    mastermind:=getstring ('New Note: ');
  362.    if length(mastermind)<>0 then begin
  363.     urec.note:=mastermind;
  364.     writeurec;
  365.     writeln ('Your User Note has been changed to: ',mastermind);
  366.    end;
  367.   end;
  368.  
  369.   procedure gotodos (i:integer);
  370.   begin
  371.     writeln ('Sysop in DOS:');
  372.     window (1,1,80,25);
  373.     gotoxy (1,25);
  374.     writeln (usr,^M^J^J^J);
  375.     updateuserstats (false);
  376.     execcomcom;
  377.   end;
  378.  
  379.   procedure runconfig;
  380.   begin
  381.     window (1,1,80,25);
  382.     textbackground(0);
  383.     gotoxy (1,25);
  384.     writeln (usr,^M^J^J^J);
  385.     updateuserstats (false);
  386.     ensureclosed;
  387.     if faqdir[length(faqdir)]<>'\' then faqdir:=faqdir+'\';
  388.     cursor (true);
  389.     Exec(GetEnv('COMSPEC'), '/C '+faqdir+'SETUP.EXE');
  390.     cursor (false);
  391.     readconfig;
  392.     if datascrambling then scrambled:=true else scrambled:=false;
  393.     chdir (copy(faqdir,1,length(faqdir)-1));
  394.   end;
  395.  
  396.   procedure dotexteditor;
  397.   begin
  398.     textbackground(0);
  399.     if length(editor)<1 then exit;
  400.     writeln ('Sysop is loading text editor:');
  401.     window (1,1,80,25);
  402.     gotoxy (1,25);
  403.     writeln (usr,^M^J^J^J);
  404.     updateuserstats (false);
  405.     ensureclosed;
  406.     cursor (true);
  407.     exec(GetEnv('COMSPEC'), '/C '+editor);
  408.     cursor (false);
  409.     chdir (copy(faqdir,1,length(faqdir)-1));
  410.   end;
  411.  
  412.   procedure doansieditor;
  413.   begin
  414.     textbackground(0);
  415.     if length(ansiedit)<1 then exit;
  416.     writeln ('Sysop is loading ansi editor:');
  417.     window (1,1,80,25);
  418.     gotoxy (1,25);
  419.     writeln (usr,^M^J^J^J);
  420.     updateuserstats (false);
  421.     ensureclosed;
  422.     cursor (true);
  423.     exec(GetEnv('COMSPEC'), '/C '+ansiedit);
  424.     cursor (false);
  425.     chdir (copy(faqdir,1,length(faqdir)-1));
  426.   end;
  427.  
  428.   procedure printf (fn:lstr);
  429.  
  430.   procedure getextension (var fname:lstr);
  431.  
  432.     procedure tryfiles (a,b,c,d:integer);
  433.     var q:boolean;
  434.  
  435.       function tryfile (n:integer):boolean;
  436.       const exts:array [1..4] of string[3]=('','ANS','ASC','40');
  437.       begin
  438.         if not exist (fname+'.'+exts[n]) then tryfile:=false else begin
  439.           tryfile:=true;
  440.           fname:=fname+'.'+exts[n]
  441.         end
  442.       end;
  443.  
  444.     begin
  445.       if tryfile (a) then exit;
  446.       if tryfile (b) then exit;
  447.       if tryfile (c) then exit;
  448.       q:=tryfile (d)
  449.     end;
  450.  
  451.   begin
  452.     if pos ('.',fname)<>0 then exit;
  453.     if ansigraphics in urec.config  then tryfiles (2,3,1,4) else
  454.     if asciigraphics in urec.config then tryfiles (3,1,4,2) else
  455.     if eightycols in urec.config    then tryfiles (1,4,3,2) else
  456.                                          tryfiles (4,1,3,2)
  457.   end;
  458.  
  459. var tf:text;
  460.     k:char;
  461. begin
  462.   clearbreak;
  463.   writeln;
  464.   getextension (fn);
  465.   assign (tf,fn);
  466.   reset (tf);
  467.   iocode:=ioresult;
  468.   if iocode<>0 then begin
  469.     fileerror ('Printfile',fn);
  470.     exit
  471.   end;
  472.   clearbreak;
  473.   while not (eof(tf) or break or hungupon) do
  474.     begin
  475.       read (tf,k);
  476.       write (k)
  477.     end;
  478.   if break then writeln (^B);
  479.   writeln;
  480.   textclose (tf);
  481.   curattrib:=0;
  482.   ansireset
  483. end;
  484.  
  485.   procedure nuke;
  486.   var q:sstr;
  487.       u:userrec;
  488.       n,x:integer;
  489.   begin
  490.     box;
  491.     q:=getstring ('Delete User? [y/n]: ');
  492.     if length(q)>0 then if upcase(q[1])='Y' then
  493.       begin
  494.         write1 ('You''re Deleted!');
  495.         deleteuser (unum);
  496.          for n:=1 to numusers do begin
  497.          seek (ufile,n);
  498.          read (ufile,u);
  499.          for x:=1 to 50 do
  500.          u.newvoteit[x]:=0;
  501.          writeufile (u,n);
  502.          end;
  503.          readurec;
  504.         if exist (textfiledir+'Delete') then
  505.          printf (textfiledir+'Delete') else
  506.         writeln ('Don''t Call Again!'^M^M);
  507.         hangup;
  508.         forcehangup:=true;
  509.         specialcommand:=true
  510.       end
  511.   end;
  512.  
  513.   procedure getsysopaccess;
  514.   const sysopstr:array [false..true] of string[6]=('Normal','Sysop');
  515.         sectionnames:array [udsysop..gfsysop] of string[20]=
  516.           ('File Transfer','Bulletin Section','Voting Booths',
  517.            'E-Mail Section','Doors','Main Menu','Databases','Trivia Sysop',
  518.            'G-File Section');
  519.   var cnt:configtype;
  520.       x:string[10];
  521.       n,mx:integer;
  522.       v:boolean;
  523.   begin
  524.     repeat
  525.       splitscreen (12);
  526.       clrscr; textbackground(0);
  527.       textcolor (15);
  528.       mx:=1;
  529.       for cnt:=udsysop to gfsysop do begin
  530.         write (usr,mx:3,'. ',sectionnames[cnt]);
  531.         mx:=mx+1;
  532.         gotoxy (25,wherey);
  533.         writeln (usr,sysopstr[cnt in urec.config])
  534.       end;
  535.       write (usr,^M^J'Number to toggle [CR/Exit]: ');
  536.       buflen:=1;
  537.       readline (x);
  538.       n:=valu(x);
  539.       v:=(n>0) and (n<mx);
  540.       if v then begin
  541.         cnt:=configtype(ord(udsysop)+n-1);
  542.         if cnt in urec.config
  543.           then
  544.             begin
  545.               urec.config:=urec.config-[cnt];
  546.               x:='denied'
  547.             end
  548.           else
  549.             begin
  550.               urec.config:=urec.config+[cnt];
  551.               x:='granted'
  552.             end;
  553.         writeln ('You have been ',x,' sysop priveleges for the ',
  554.                  sectionnames[cnt],'.')
  555.       end
  556.     until not v;
  557.     writeurec;
  558.     clrscr;
  559.     splitscreen (17);
  560.     exit;
  561.   end;
  562.  
  563.   procedure runusereditor;
  564.   begin
  565.     window (1,1,80,25);
  566.     gotoxy (1,25);
  567.     textbackground (0);
  568.     writeln (usr,^M^J^J^J);
  569.    (* updateuserstats (false);
  570.     ensureclosed; *)
  571.     if faqdir[length(faqdir)]<>'\' then faqdir:=faqdir+'\';
  572.     Exec(GetEnv('COMSPEC'), '/C FAQUE.EXE');
  573.     if datascrambling then scrambled:=true else scrambled:=false;
  574.     clrscr;
  575.   end;
  576.  
  577. procedure cursor (csize:byte);
  578. var regs:registers;
  579. begin
  580.    case (csize) of
  581.       1: if mem[0:$449]=7 then regs.cx:=$0c0d  (* Underline  = 1 *)
  582.          else regs.cx:=$0607;
  583.       2: if mem[0:$449]=7 then regs.cx:=$060d  (* Full Block = 2 *)
  584.          else regs.cx:=$0007;
  585.       3: regs.cx:=$2000;                       (* No Cursor  = 3 *)
  586.    end;
  587.    regs.ax:=$0100;
  588.    intr ($10,regs);
  589. end;
  590.  
  591. const memrows=25;
  592.       memcols=80;
  593. var scom:char;
  594.     k,c:char;
  595.     quit:boolean;
  596.     x,y:integer;
  597.  
  598. procedure writetop;
  599. begin
  600.   gotoxy (1,1);
  601.   textbackground (1);
  602.   textcolor (c1);
  603.   cursor (3);
  604.   writeln (usr,'┌───────────────────────────────────────────────────────────────────────┐');
  605.   write (usr,'│ ');
  606.   textcolor (c1);
  607.   write (usr,'User Editing          Utilities         Extra Commands');
  608.   textcolor (c1);
  609.   writeln (usr,'                │');
  610.   writeln (usr,'└───────────────────────────────────────────────────────────────────────┘');
  611.  (* gotoxy (1,16);
  612.   textcolor (15);
  613.   textbackground (4);
  614.  
  615.   write (usr,'[   Sysop Pull Down Menu System - '+#24+','+#25+','+#26+','+#27+',Home,End to Move - [CR] to Select   ]');
  616. *) textbackground (0);
  617. end;
  618.  
  619. procedure writebar (s:anystr);
  620. var monolith:integer;
  621. begin
  622.  textbackground (1);
  623.  textcolor (11);
  624.  for monolith:=1 to length(s) do
  625.  begin
  626.   if s[monolith] in [' '..'~'] then begin
  627.    textbackground (1);
  628.    textcolor (11);
  629.    write (usr,s[monolith]);
  630.   end else
  631.   begin
  632.    textbackground (1);
  633.    textcolor (15);
  634.    write (usr,s[monolith]);
  635.   end;
  636.  end;
  637.  textbackground (1);
  638. end;
  639.  
  640. procedure movebar (xx:integer; dir:char);
  641. var satan,dogchild,floyd:integer;
  642. begin
  643.  dir:=upcase(dir);
  644.  case x of
  645.   1:begin
  646.      textcolor (c1);
  647.      textbackground (1);
  648.      satan:=y;
  649.      gotoxy (3,satan+2);
  650.      write (usr,edituser[satan]);
  651.      if dir='U' then y:=y-1 else
  652.      if dir='D' then y:=y+1 else
  653.      if dir='S' then y:=y;
  654.      if y>11 then y:=2;
  655.      if y<2 then y:=11;
  656.      gotoxy (3,y+2);
  657.      writebar (edituser[y]);
  658.     end;
  659.   2:begin
  660.      textcolor (c1);
  661.      textbackground (1);
  662.      dogchild:=y;
  663.      gotoxy (w2,dogchild+2);
  664.      write (usr,utils[dogchild]);
  665.      if dir='U' then y:=y-1 else
  666.      if dir='D' then y:=y+1 else
  667.      if dir='S' then y:=y;
  668.      if y>5 then y:=2;
  669.      if y<2 then y:=5;
  670.      gotoxy (w2,y+2);
  671.      writebar (utils[y]);
  672.     end;
  673.   3:begin
  674.      textcolor (c1);
  675.      textbackground (1);
  676.      floyd:=y;
  677.      gotoxy (w3,floyd+2);
  678.      write (usr,extra[floyd]);
  679.      if dir='U' then y:=y-1 else
  680.      if dir='D' then y:=y+1 else
  681.      if dir='S' then y:=y;
  682.      if y>6 then y:=2;
  683.      if y<2 then y:=6;
  684.      gotoxy (w3,y+2);
  685.      writebar (extra[y]);
  686.     end;
  687.  end;
  688. end;
  689.  
  690. procedure movebox (ex,ey:integer);
  691. var anarky,burger,two:integer;
  692. begin
  693.  cursor (3);
  694.  case ex of
  695.   1:begin
  696.      if x=2 then begin
  697.       gotoxy (w2,2);
  698.       textcolor (c1);
  699.       textbackground (1);
  700.       write (usr,' Utilities');
  701.       textcolor (c1);
  702.       gotoxy (w2,3);
  703.       write (usr,'───────────────────────────');
  704.      end else
  705.      if x=3 then begin
  706.       gotoxy (w3,2);
  707.       textcolor (c1);
  708.       textbackground (1);
  709.       write (usr,' Extra Commands');
  710.       textcolor (c1);
  711.       gotoxy (w3,3);
  712.       write (usr,'─────────────────────────────');
  713.      end;
  714.      x:=1;
  715.      gotoxy (3,2);
  716.      textbackground (1);
  717.      textcolor (c4);
  718.      write (usr,'User Editing');
  719.      textcolor (c3);
  720.      for anarky:=1 to 12 do
  721.      begin
  722.       gotoxy (3,anarky+2);
  723.       write (usr,edituser[anarky]);
  724.      end;
  725.      if y>10 then y:=1;
  726.      textbackground (1);
  727.     end;
  728.   2:begin
  729.      if x=1 then begin
  730.       gotoxy (3,2);
  731.       textcolor (c1);
  732.       textbackground (1);
  733.       write (usr,'User Editing');
  734.       textcolor (c1);
  735.       gotoxy (3,3);
  736.       write (usr,'─────────────────────');
  737.      end else
  738.      if x=3 then begin
  739.       gotoxy (w3,2);
  740.       textcolor (c1);
  741.       textbackground (1);
  742.       write (usr,' Extra Commands');
  743.       textcolor (c1);
  744.       gotoxy (w3,3);
  745.       write (usr,'─────────────────────────────');
  746.      end;
  747.      x:=2;
  748.      gotoxy (w2,2);
  749.      textbackground (1);
  750.      textcolor (c4);
  751.      write (usr,' Utilities');
  752.      textcolor (c3);
  753.      for burger:=1 to 6 do
  754.      begin
  755.       gotoxy (w2,burger+2);
  756.       write (usr,utils[burger]);
  757.       textbackground (1);
  758.       textcolor (c3);
  759.      end;
  760.     end;
  761.   3:begin
  762.      if x=1 then begin
  763.       gotoxy (3,2);
  764.       textcolor (c1);
  765.       textbackground (1);
  766.       write (usr,'User Editing');
  767.       textcolor (c1);
  768.       gotoxy (3,3);
  769.       write (usr,'─────────────────────');
  770.      end else
  771.      if x=2 then begin
  772.       gotoxy (w2,2);
  773.       textcolor (c1);
  774.       textbackground (1);
  775.       write (usr,' Utilities');
  776.       textcolor (c1);
  777.       gotoxy (w2,3);
  778.       write (usr,'──────────────────────');
  779.      end;
  780.      x:=3;
  781.      gotoxy (w3,2);
  782.      textbackground (1);
  783.      textcolor (c4);
  784.      write (usr,' Extra Commands');
  785.      textcolor (c3);
  786.      for two:=1 to 7 do
  787.      begin
  788.       gotoxy (w3,two+2);
  789.       write (usr,extra[two]);
  790.       textbackground (1);
  791.       textcolor (c3);
  792.      end;
  793.     end;
  794.  end;
  795. end;
  796.  
  797. procedure eraseall;
  798. begin
  799. (* qfill (4,1,11,80,black+blackbg,' '); *)
  800.  textbackground (0);
  801.  clrscr;
  802.  writetop;
  803. end;
  804.  
  805. procedure movedown (x,y:integer);
  806. begin
  807.  movebar (x,'D'); 
  808. end;
  809.  
  810. procedure moveup (x,y:integer);
  811. begin
  812.  movebar (x,'U');
  813. end;
  814.  
  815. procedure moveright (x,y:integer);
  816. begin
  817.  y:=1;
  818.  x:=x+1;
  819.  if x>3 then x:=1;
  820.  eraseall;
  821.  y:=1;
  822.  movebox (x,y);
  823.  movebar (x,'S');
  824. end;
  825.  
  826. procedure moveleft (x,y:integer);
  827. begin
  828.  y:=1;
  829.  x:=x-1;
  830.  if x<1 then x:=3;
  831.  eraseall;
  832.  y:=1;
  833.  movebox (x,y);
  834.  y:=1;
  835.  movebar (x,'S');
  836. end;
  837.  
  838. function processcommand:char;
  839. begin
  840.  cursor (1);
  841.  case x of
  842.   1:begin
  843.      case y of
  844.       2:getnewname;
  845.       3:getnewlevel;
  846.       4:getxferlevel;
  847.       5:getxferpoints;
  848.       6:makenote;
  849.       7:getnewtime;
  850.       8:getnewpassword;
  851.       9:getnewgflevel;
  852.       10:getnewaccess;
  853.       11:getsysopaccess;
  854.      end;
  855.     end;
  856.   2:begin
  857.      case y of
  858.       2:hangupyn;
  859.       3:nuke;
  860.       4:snoopmode;
  861.       5:unsnoop;
  862.      end;
  863.     end;
  864.   3:begin
  865.      case y of
  866.       2:begin gotodos (1); clrscr; end;
  867.       3:begin runconfig; clrscr; end;
  868.       4:begin runusereditor; clrscr; end;
  869.       5:begin dotexteditor; clrscr; end;
  870.       6:begin doansieditor; clrscr; end;
  871.      end;
  872.     end;
  873.  end;
  874.  cursor (3);
  875.  case x of
  876.   1:begin
  877.      case y of
  878.       2:processcommand:='N';
  879.       3:processcommand:='L';
  880.       4:processcommand:='F';
  881.       5:processcommand:='F';
  882.       6:processcommand:='R';
  883.       7:processcommand:='T';
  884.       8:processcommand:='P';
  885.       9:processcommand:='G';
  886.       10:processcommand:='B';
  887.       11:processcommand:='Y';
  888.      end;
  889.     end;
  890.   2:begin
  891.      case y of
  892.       2:processcommand:='H';
  893.       3:processcommand:='N';
  894.       4:begin
  895.          processcommand:='S';
  896.          quit:=true;
  897.         end;
  898.       5:begin
  899.          processcommand:='Z';
  900.          quit:=true;
  901.         end;
  902.      end;
  903.     end;
  904.   3:begin
  905.      case y of
  906.       2:processcommand:='D';
  907.       3:processcommand:='C';
  908.       4:processcommand:='U';
  909.       5:processcommand:='E';
  910.       6:processcommand:='A';
  911.      end;
  912.      quit:=true;
  913.     end;
  914.  end;
  915.  done1;
  916. end;
  917.  
  918. begin
  919.   writeln (^B^M'Please Wait:');
  920.   splitscreen (17);
  921.   top;
  922.   clrscr;
  923.   specialcommand:=false;
  924.   x:=1;
  925.   y:=2;
  926.   writetop;
  927.   movebox (x,y);
  928.   movebar (x,'S');
  929.   quit:=false;
  930.   repeat
  931.    c:=bioskey;
  932.    case ord(c) of
  933.     27:begin
  934.         quit:=true;
  935.         scom:='Q';
  936.        end;
  937.     13:scom:=processcommand;
  938.     208:movedown (x,y);
  939.     200:moveup (x,y);
  940.     203:moveleft (x,y);
  941.     205:moveright (x,y);
  942.     199:begin
  943.          y:=2;
  944.          movebox (x,y);
  945.          movebar (x,'S');
  946.         end;
  947.     207:begin
  948.          if x>1 then y:=5 else y:=11;
  949.          movebox (x,y);
  950.          movebar (x,'S');
  951.         end;
  952.    end;
  953.   until quit;
  954.   cursor (1);
  955.   bottomline;
  956.   specialcommand:=scom in ['Q','S','Z','D','C','U','E'];
  957.   unsplit
  958. end;}
  959.  
  960. Function specialcommand:Boolean;
  961.  
  962.   Procedure getnewtime;
  963.     Var q:sstr;
  964.       n:Integer;
  965.     Begin
  966.       n:=timeleft;
  967.       WriteLn(Usr,'The user has ',n,' minutes left.');
  968.       Write(Usr,'New Time Left: ');
  969.       cursor (true);
  970.       readline(q);
  971.       cursor (false);
  972.       If Length(q)>0 Then Begin
  973.         urec.timetoday:=urec.timetoday+(valu(q)-n);
  974.         writeurec;
  975.         {      writeln ('You have been granted ',timeleft,' minutes for today.')
  976.       }End
  977.     End;
  978.  
  979.   Procedure getnewlevel;
  980.     Var q:sstr;
  981.       n:Integer;
  982.     Begin
  983.       WriteLn(Usr,'Current Main Level: ',ulvl);
  984.       Write(Usr,'New Main Level [-1 to trash]: ');
  985.       cursor (true);
  986.       readline(q);
  987.       cursor (false);
  988.       If Length(q)>0 Then Begin
  989.         n:=valu(q);
  990.         ulvl:=n;
  991.         urec.level:=n;
  992.         writeurec;
  993.         {    writeln ('You have been granted level ',n,' access.');
  994.         if n=-1 then writeln ('That means you''ve been kicked off this system.')
  995.       }End
  996.     End;
  997.  
  998.  
  999.   Procedure gfilez;
  1000.     Var q:sstr;
  1001.       n:Integer;
  1002.     Begin
  1003.  
  1004.       WriteLn(Usr,'Current G-File level: ',urec.gflevel);
  1005.       Write(Usr,'New G-File Level: ');
  1006.       cursor (true);
  1007.       readline(q);
  1008.       cursor (false);
  1009.       If Length(q)>0 Then Begin
  1010.         n:=valu(q);
  1011.         urec.gflevel:=n;
  1012.         writeurec;
  1013.       End;
  1014.     End;
  1015.  
  1016.   Procedure hangupyn;
  1017.     Var q:sstr;
  1018.     Begin
  1019.       textbackground (0);
  1020.       gotoxy (1,13);
  1021.       Write(Usr,'Hang Up on User? ');
  1022.       cursor (true);
  1023.       readline(q);
  1024.       cursor (false);
  1025.       If Length(q)>0 Then If UpCase(q[1])='Y' Then
  1026.         Begin
  1027.           WriteLn('Call back later!'^M);
  1028.           hangup;
  1029.           forcehangup:=True;
  1030.           specialcommand:=True
  1031.         End
  1032.     End;
  1033.  
  1034.   Procedure getnewname;
  1035.     Var m:mstr;
  1036.       n:Integer;
  1037.       t:String[1];
  1038.     Begin
  1039.       WriteLn(Usr,'Current Handle: ',unam);
  1040.       Write(Usr,'New Handle: ');
  1041.       cursor (true);
  1042.       readline(m);
  1043.       cursor (false);
  1044.       If Length(m)<>0 Then Begin
  1045.         n:=lookupuser(m);
  1046.         If n<>0 Then Begin
  1047.           Write(Usr,'Name already exists!  Are you sure? ');
  1048.           BufLen:=1;
  1049.           cursor (true);
  1050.           readline(t);
  1051.           buflen:=80;
  1052.           cursor (false);
  1053.           If UpCase(t[1])<>'Y' Then exit
  1054.         End;
  1055.         unam:=m;
  1056.         urec.handle:=m;
  1057.         writeurec;
  1058.     End;End;
  1059.  
  1060.   Procedure getnewpassword;
  1061.     Var m:mstr;
  1062.     Begin
  1063.       WriteLn(Usr,'Current Password: ',urec.password);
  1064.       Write(Usr,'New Password: ');
  1065.       cursor (true);
  1066.       readline(m);
  1067.       cursor (false);
  1068.       If Length(m)<>0 Then Begin
  1069.         urec.password:=m;
  1070.         writeurec;
  1071.       End
  1072.     End;
  1073.  
  1074.   Procedure getnewudlvl;
  1075.     Var m:mstr;
  1076.        i:integer;
  1077.     Begin
  1078.       WriteLn(Usr,'Current Xfer Level:  ',urec.udlevel);
  1079.       write (usr,'New Xfer Level: ');
  1080.       cursor (true);
  1081.       readline(m);
  1082.       cursor (false);
  1083.       If Length(m)>0 Then Begin
  1084.       i:=valu(m);
  1085.       urec.udlevel:=i;
  1086.       writeurec;
  1087.  
  1088.       End
  1089.     End;
  1090.  
  1091.   Procedure getnewudpts;
  1092.     Var m:mstr;
  1093.        i:integer;
  1094.     Begin
  1095.       WriteLn(Usr,'Current Xfer Points:  ',urec.udpoints);
  1096.       write (usr,'New Xfer Points: ');
  1097.       cursor (true);
  1098.       readline(m);
  1099.       cursor (false);
  1100.       If Length(m)>0 Then Begin
  1101.       i:=valu(m);
  1102.       urec.udpoints:=i;
  1103.       writeurec;
  1104.  
  1105.       End
  1106.     End;
  1107.  
  1108.   procedure printf (fn:lstr);
  1109.  
  1110.   procedure getextension (var fname:lstr);
  1111.  
  1112.     procedure tryfiles (a,b,c,d:integer);
  1113.     var q:boolean;
  1114.  
  1115.       function tryfile (n:integer):boolean;
  1116.       const exts:array [1..4] of string[3]=('','ANS','ASC','40');
  1117.       begin
  1118.         if not exist (fname+'.'+exts[n]) then tryfile:=false else begin
  1119.           tryfile:=true;
  1120.           fname:=fname+'.'+exts[n]
  1121.         end
  1122.       end;
  1123.  
  1124.     begin
  1125.       if tryfile (a) then exit;
  1126.       if tryfile (b) then exit;
  1127.       if tryfile (c) then exit;
  1128.       q:=tryfile (d)
  1129.     end;
  1130.  
  1131.   begin
  1132.     if pos ('.',fname)<>0 then exit;
  1133.     if ansigraphics in urec.config  then tryfiles (2,3,1,4) else
  1134.     if asciigraphics in urec.config then tryfiles (3,1,4,2) else
  1135.     if eightycols in urec.config    then tryfiles (1,4,3,2) else
  1136.                                          tryfiles (4,1,3,2)
  1137.   end;
  1138.  
  1139. var tf:text;
  1140.     k:char;
  1141. begin
  1142.   clearbreak;
  1143.   writeln;
  1144.   getextension (fn);
  1145.   assign (tf,fn);
  1146.   reset (tf);
  1147.   iocode:=ioresult;
  1148.   if iocode<>0 then begin
  1149.     fileerror ('Printfile',fn);
  1150.     exit
  1151.   end;
  1152.   clearbreak;
  1153.   while not (eof(tf) or break or hungupon) do
  1154.     begin
  1155.       read (tf,k);
  1156.       write (k)
  1157.     end;
  1158.   if break then writeln (^B);
  1159.   writeln;
  1160.   textclose (tf);
  1161.   curattrib:=0;
  1162.   ansireset
  1163. end;
  1164.  
  1165.   procedure nuke;
  1166.   var q:sstr;
  1167.       u:userrec;
  1168.       n,x:integer;
  1169.   begin
  1170.       textbackground (0);
  1171.       gotoxy (1,13);
  1172.       Write(Usr,'Delete User? ');
  1173.       cursor (true);
  1174.       readline(q);
  1175.       cursor (false);
  1176.       If Length(q)>0 Then If UpCase(q[1])='Y' Then
  1177.         Begin
  1178.         writeln ('You''re Deleted!'^M);
  1179.         deleteuser (unum);
  1180.          for n:=1 to numusers do begin
  1181.          seek (ufile,n);
  1182.          read (ufile,u);
  1183.          for x:=1 to 50 do
  1184.          u.newvoteit[x]:=0;
  1185.          writeufile (u,n);
  1186.          end;
  1187.          readurec;
  1188.         if exist (textfiledir+'Delete') then
  1189.          printf (textfiledir+'Delete') else
  1190.         writeln ('Don''t Call Again!'^M^M);
  1191.         hangup;
  1192.         forcehangup:=true;
  1193.         specialcommand:=true
  1194.       end
  1195.   end;
  1196.  
  1197.   Procedure snoopmode;
  1198.     Begin
  1199.       WriteLn(Usr,'All I/O to the modem is locked.');
  1200.       modeminlock:=True;
  1201.       setoutlock(True)
  1202.     End;
  1203.  
  1204.   Procedure unsnoop;
  1205.     Begin
  1206.       WriteLn(Usr,'I/O to the modem is re-enabled.');
  1207.       modeminlock:=False;
  1208.       setoutlock(False)
  1209.     End;
  1210.  
  1211.   procedure gotodos;
  1212.   begin
  1213.     writeln ('Sysop in DOS:');
  1214.     window (1,1,80,25);
  1215.     gotoxy (1,25);
  1216.     writeln (usr,^M^J^J^J);
  1217.     {updateuserstats (false);}
  1218.     cursor (true);
  1219.     execcomcom;
  1220.     cursor (false);
  1221.   end;
  1222.  
  1223.   procedure runconfig;
  1224.   begin
  1225.     window (1,1,80,25);
  1226.     textbackground(0);
  1227.     gotoxy (1,25);
  1228.     writeln (usr,^M^J^J^J);
  1229.    (* updateuserstats (false);
  1230.     ensureclosed; *)
  1231.     if faqdir[length(faqdir)]<>'\' then faqdir:=faqdir+'\';
  1232.     cursor (true);
  1233.     Exec(GetEnv('COMSPEC'), '/C '+faqdir+'SETUP.EXE');
  1234.     cursor (false);
  1235.     readconfig;
  1236.     if datascrambling then scrambled:=true else scrambled:=false;
  1237.     chdir (copy(faqdir,1,length(faqdir)-1));
  1238.   end;
  1239.  
  1240.   procedure dotexteditor;
  1241.   begin
  1242.     textbackground(0);
  1243.     if length(editor)<1 then exit;
  1244.     writeln ('Sysop is loading text editor:');
  1245.     window (1,1,80,25);
  1246.     gotoxy (1,25);
  1247.     writeln (usr,^M^J^J^J);
  1248.    (* updateuserstats (false);
  1249.     ensureclosed; *)
  1250.     cursor (true);
  1251.     exec(GetEnv('COMSPEC'), '/C '+editor);
  1252.     cursor (false);
  1253.     chdir (copy(faqdir,1,length(faqdir)-1));
  1254.   end;
  1255.  
  1256.   procedure doansieditor;
  1257.   begin
  1258.     textbackground(0);
  1259.     if length(ansiedit)<1 then exit;
  1260.     writeln ('Sysop is loading ansi editor:');
  1261.     window (1,1,80,25);
  1262.     gotoxy (1,25);
  1263.     writeln (usr,^M^J^J^J);
  1264.    (* updateuserstats (false);
  1265.     ensureclosed; *)
  1266.     cursor (true);
  1267.     exec(GetEnv('COMSPEC'), '/C '+ansiedit);
  1268.     cursor (false);
  1269.     chdir (copy(faqdir,1,length(faqdir)-1));
  1270.   end;
  1271.  
  1272.   Procedure getsysopaccess;
  1273.     Const sysopstr:Array[false..true] Of String[6]=('Normal','Sysop');
  1274.       sectionnames:Array[udsysop..databasesysop] Of String[20]=
  1275.       ('File transfer','Bulletin section','Voting booths',
  1276.       'E-mail section','Doors','Main menu','Databases');
  1277.     Var cnt:configtype;
  1278.       x:String[10];
  1279.       n,mx:Integer;
  1280.       v:Boolean;
  1281.     Begin
  1282.       Repeat
  1283.         ClrScr;
  1284.         mx:=1;
  1285.         For cnt:=udsysop To databasesysop Do Begin
  1286.           Write(Usr,mx:3,'. ',sectionnames[cnt]);
  1287.           mx:=mx+1;
  1288.           GoToXY(25,WhereY);
  1289.           WriteLn(Usr,sysopstr[cnt In urec.config])
  1290.         End;
  1291.         Write(Usr,^M^J'Number to toggle [CR to exit]: ');
  1292.         BufLen:=1;
  1293.         cursor (true);
  1294.         readline(x);
  1295.         cursor (false);
  1296.         n:=valu(x);
  1297.         v:=(n>0) And (n<mx);
  1298.         If v Then Begin
  1299.           cnt:=configtype(Ord(udsysop)+n-1);
  1300.           If cnt In urec.config
  1301.           Then
  1302.             Begin
  1303.               urec.config:=urec.config-[cnt];
  1304.               x:='denied'
  1305.             End
  1306.           Else
  1307.             Begin
  1308.               urec.config:=urec.config+[cnt];
  1309.               x:='granted'
  1310.             End;
  1311.           {      writeln ('You have been ',x,' sysop priveleges for the ',
  1312.           sectionnames[cnt],'.')
  1313.         }End
  1314.       Until Not v;
  1315.       writeurec
  1316.     End;
  1317.  
  1318. procedure Pulldownmenu;
  1319.  
  1320. procedure ahigh (x:integer);
  1321. var c:char;
  1322.     y,z,a:integer;
  1323.     dir:string[127];
  1324.  
  1325. begin
  1326.     case x of
  1327.       1:begin
  1328.             gotoxy (2,3);
  1329.             textbackground (1);
  1330.             textcolor (15);
  1331.             write (usr,' Root Directory ');
  1332.             textbackground (15);
  1333.             textcolor (4);
  1334.         end;
  1335.       2:begin
  1336.             gotoxy (2,4);
  1337.             textbackground (1);
  1338.             textcolor (15);
  1339.             write (usr,' Other Dir      ');
  1340.             textbackground (15);
  1341.             textcolor (4);
  1342.         end;
  1343.     end;
  1344. end;
  1345.  
  1346.  
  1347. procedure high (x:integer);
  1348. begin
  1349.      case x of
  1350.       1:begin
  1351.             gotoxy (2,2);
  1352.             textbackground (7);
  1353.             textcolor (15);
  1354.             write (usr,' User Editor ');
  1355.         end;
  1356.       2:begin
  1357.             gotoxy (16,2);
  1358.             textbackground (7);
  1359.             textcolor (15);
  1360.             write (usr,' External ');
  1361.         end;
  1362.       3:begin
  1363.             gotoxy (27,2);
  1364.             textbackground (7);
  1365.             textcolor (15);
  1366.             write (usr,' Shell to DOS ');
  1367.         end;
  1368.       4:begin
  1369.             gotoxy (42,2);
  1370.             textbackground (7);
  1371.             textcolor (15);
  1372.             write (usr,' Hang Up ');
  1373.         end;
  1374.       5:begin
  1375.             gotoxy (52,2);
  1376.             textbackground (7);
  1377.             textcolor (15);
  1378.             write (usr,' Delete User ');
  1379.         end;
  1380.       6:begin
  1381.             gotoxy (66,2);
  1382.             textbackground (7);
  1383.             textcolor (15);
  1384.             write (usr,' Help ');
  1385.         end;
  1386.       7:begin
  1387.             gotoxy (73,2);
  1388.             textbackground (7);
  1389.             textcolor (15);
  1390.             write (usr,' Quit ');
  1391.         end;
  1392.      end;
  1393. end;
  1394.  
  1395. procedure dohelp;
  1396. begin
  1397.      gotoxy (25,10);
  1398.      textbackground (1);
  1399.      textcolor (15);
  1400.      writeln (usr,'┌──────────────────────┐');
  1401.      gotoxy (25,11);
  1402.      write (usr,'│  ');
  1403.      textcolor (11);
  1404.      write (#27,#26,#25,#24+' - Move Bar');
  1405.      textcolor (15);
  1406.      writeln (usr,'     │');
  1407.      gotoxy (25,12);
  1408.      write (usr,'│ ');
  1409.      textcolor (11);
  1410.      write (usr,' [Return] - Select');
  1411.      textcolor (15);
  1412.      writeln (usr,'   │');
  1413.      gotoxy (25,13);
  1414.      write (usr,'│ ');
  1415.      textcolor (11);
  1416.      write (usr,' ESC - Quits to Main ');
  1417.      textcolor (15);
  1418.      writeln (usr,'│');
  1419.      gotoxy (25,14);
  1420.      writeln (usr,'└──────────────────────┘');
  1421.      repeat
  1422.      until keypressed;
  1423. end;
  1424.  
  1425.  
  1426. procedure changedir2;
  1427. var c:char;
  1428.     x,y,z,a:integer;
  1429.     dir:string[127];
  1430.  
  1431. begin
  1432.      gotoxy (6,10);
  1433.      textbackground (1);
  1434.      textcolor (15);
  1435.      writeln (usr,'┌─── Enter Directory ──────────────┐');
  1436.      gotoxy (6,11);
  1437.      writeln (usr,'│                                  │');
  1438.      gotoxy (6,12);
  1439.      writeln (usr,'└──────────────────────────────────┘');
  1440.      gotoxy (8,11);
  1441.      textcolor (14);
  1442.      cursor (true);
  1443.      readln (dir);
  1444.      cursor (false);
  1445.      if doserror <> 0 then begin
  1446.        gotoxy (1,14);
  1447.        textcolor (15);
  1448.        textbackground (0);
  1449.        writeln (usr,'Invalid Directory!');
  1450.        exit;
  1451.      end;
  1452.      chdir (dir);
  1453.      textbackground (0);
  1454.      gotoxy (6,10);
  1455.      clreol;
  1456.      gotoxy (6,11);
  1457.      clreol;
  1458.      gotoxy (6,12);
  1459.      clreol;
  1460. end;
  1461.  
  1462. procedure changedir;
  1463. var c:char;
  1464.     x,y,z,a:integer;
  1465.     dir:string[127];
  1466.  
  1467. begin
  1468.      textbackground (1);
  1469.      textcolor (15);
  1470.      ahigh (y);
  1471.      gotoxy (1,5);
  1472.      writeln (usr,'┌────────────────┐');
  1473.      writeln (usr,'│ Root Directory │');
  1474.      writeln (usr,'│ Other Dir      │');
  1475.      writeln (usr,'└────────────────┘');
  1476.      textbackground (1);
  1477.      textcolor (15);
  1478.      gotoxy (2,2);
  1479.      ahigh (y);
  1480.      repeat
  1481.        c:=readkey;
  1482.        c:=upcase (c);
  1483.      until c in [#77,#75,#72,#80,#27,#13];
  1484.      if (c=#77) or (c=#80) then y:=y+1;
  1485.      if (c=#75) or (c=#72) then y:=y-1;
  1486.      if y=3 then y:=1;
  1487.      if y=0 then y:=2;
  1488.      if c=#27 then exit;
  1489.      if c=#13 then begin;
  1490.        case y of
  1491.         1:chdir('\');
  1492.         2:changedir2;
  1493.        end;
  1494.      end;
  1495.     changedir
  1496. end;
  1497.  
  1498. procedure makedir;
  1499. var c:char;
  1500.     x,y,z,a:integer;
  1501.     dir:string[127];
  1502.  
  1503. begin
  1504.      gotoxy (6,10);
  1505.      textbackground (1);
  1506.      textcolor (15);
  1507.      writeln (usr,'┌─── Enter Directory ──────────────┐');
  1508.      gotoxy (6,11);
  1509.      writeln (usr,'│                                  │');
  1510.      gotoxy (6,12);
  1511.      writeln (usr,'└──────────────────────────────────┘');
  1512.      gotoxy (8,11);
  1513.      textcolor (14);
  1514.      cursor (true);
  1515.      readln (dir);
  1516.      cursor (false);
  1517.      if doserror <> 0 then begin
  1518.       writeln (usr,'Invalid Directory Name!');
  1519.       exit;
  1520.      end;
  1521.      mkdir (dir);
  1522.      textbackground (0);
  1523.      gotoxy (6,10);
  1524.      clreol;
  1525.      gotoxy (6,11);
  1526.      clreol;
  1527.      gotoxy (6,12);
  1528.      clreol;
  1529. end;
  1530.  
  1531. procedure copyproc;
  1532. var c:char;
  1533.     x,y,z,a:integer;
  1534.     dir:string[127];
  1535.  
  1536. var cf,ct:string;
  1537. begin
  1538.      gotoxy (1,8);
  1539.      textcolor (14);
  1540.      textbackground (1);
  1541.      writeln (usr,'┌── Copy ───────────────────────────────────────────┐');
  1542.      writeln (usr,'│                                                   │');
  1543.      writeln (usr,'└───────────────────────────────────────────────────┘');
  1544.      gotoxy (3,9);
  1545.      textcolor (15);
  1546.      cursor (true);
  1547.      readln (cf);
  1548.      cursor (false);
  1549.      if doserror <> 0 then begin
  1550.        writeln (usr,'Invalid Filename or File doesn''t Exist!');
  1551.        exit;
  1552.      end;
  1553.      gotoxy (1,12);
  1554.      textcolor (14);
  1555.      writeln (usr,'┌── To ─────────────────────────────────────────────┐');
  1556.      writeln (usr,'│                                                   │');
  1557.      writeln (usr,'└───────────────────────────────────────────────────┘');
  1558.      gotoxy (3,13);
  1559.      textcolor (15);
  1560.      cursor (true);
  1561.      readln (ct);
  1562.      cursor (false);
  1563.      if length(ct)=0 then begin
  1564.        writeln (usr,'Invalid Directory or Filename!');
  1565.        exit;
  1566.      end;
  1567.      gotoxy (1,17);
  1568.      textcolor (11);
  1569.      textbackground (0);
  1570.      write (usr,'Copying ');
  1571.      textcolor (15);
  1572.      write (cf);
  1573.      textcolor (11);
  1574.      write (usr,' to ');
  1575.      textcolor (15);
  1576.      write (ct);
  1577.      textcolor (11);
  1578.      write (usr,'.');
  1579.      exec(getenv('COMSPEC'),'/C copy '+cf+' '+ct);
  1580.      gotoxy (1,8);
  1581.      for a:=8 to 18 do begin
  1582.       gotoxy (1,a);
  1583.       clreol;
  1584.      end;
  1585. end;
  1586.  
  1587. procedure moveproc;
  1588. var mf,mt:string;
  1589. var c:char;
  1590.     x,y,z,a:integer;
  1591.     dir:string[127];
  1592.  
  1593. begin
  1594.      gotoxy (1,8);
  1595.      textcolor (14);
  1596.      textbackground (1);
  1597.      writeln (usr,'┌── Move ───────────────────────────────────────────┐');
  1598.      writeln (usr,'│                                                   │');
  1599.      writeln (usr,'└───────────────────────────────────────────────────┘');
  1600.      gotoxy (3,9);
  1601.      textcolor (15);
  1602.      cursor (true);
  1603.      readln (mf);
  1604.      cursor (false);
  1605.      if length(mf)=0 then begin
  1606.        writeln (usr,'Invalid Filename!');
  1607.        exit;
  1608.      end;
  1609.      gotoxy (1,12);
  1610.      textcolor (14);
  1611.      writeln (usr,'┌── To ─────────────────────────────────────────────┐');
  1612.      writeln (usr,'│                                                   │');
  1613.      writeln (usr,'└───────────────────────────────────────────────────┘');
  1614.      gotoxy (3,13);
  1615.      textcolor (15);
  1616.      cursor (true);
  1617.      readln (mt);
  1618.      cursor (false);
  1619.      if length(mt)=0 then begin
  1620.        writeln (usr,'Invalid Directory or Filename!');
  1621.        exit;
  1622.      end;
  1623.      gotoxy (1,16);
  1624.      textcolor (11);
  1625.      write (usr,'Moving ');
  1626.      textcolor (15);
  1627.      write (mf);
  1628.      textcolor (11);
  1629.      write (usr,'to ');
  1630.      textcolor (15);
  1631.      write (mt);
  1632.      textcolor (11);
  1633.      write (usr,'.   ');
  1634.      exec(getenv('COMSPEC'),'/C MOVE '+MF+' '+MT);
  1635.      if doserror <> 0 then writeln (usr,'MOVE.COM not found!');
  1636.      textbackground (0);
  1637.      for a:=8 to 25 do begin
  1638.       gotoxy (1,a);
  1639.       clreol;
  1640.      end;
  1641. end;
  1642.  
  1643. procedure bhigh (x:integer);
  1644. var c:char;
  1645.     y,z,a:integer;
  1646.     dir:string[127];
  1647.  
  1648. begin
  1649.      case x of
  1650.        1:begin
  1651.              gotoxy (3,4);
  1652.              textcolor (15);
  1653.              textbackground (7);
  1654.              write (usr,' Handle       ');
  1655.          end;
  1656.        2:begin
  1657.              gotoxy (3,5);
  1658.              textcolor (15);
  1659.              textbackground (7);
  1660.              write (usr,' Password     ');
  1661.          end;
  1662.        3:begin
  1663.              gotoxy (3,6);
  1664.              textcolor (15);
  1665.              textbackground (7);
  1666.              write (usr,' Main Level   ');
  1667.          end;
  1668.        4:begin
  1669.              gotoxy (3,7);
  1670.              textcolor (15);
  1671.              textbackground (7);
  1672.              write (usr,' Xfer Level   ');
  1673.          end;
  1674.        5:begin
  1675.              gotoxy (3,8);
  1676.              textcolor (15);
  1677.              textbackground (7);
  1678.              write (usr,' G-File Level ');
  1679.          end;
  1680.        6:begin
  1681.              gotoxy (3,9);
  1682.              textcolor (15);
  1683.              textbackground (7);
  1684.              write (usr,' Xfer Points  ');
  1685.          end;
  1686.        7:begin
  1687.              gotoxy (3,10);
  1688.              textcolor (15);
  1689.              textbackground (7);
  1690.              write (usr,' Time Left    ');
  1691.          end;
  1692.      end;
  1693. end;
  1694.  
  1695. procedure execcmds;
  1696. var c:char;
  1697.     x,y,z,a:integer;
  1698.     dir:string[127];
  1699.     DD:boolean;
  1700. begin
  1701. z:=1;
  1702. dd:=false;
  1703. repeat
  1704.      gotoxy (2,3);
  1705.      textbackground (1);
  1706.      textcolor (15);
  1707.      writeln (usr,'┬──────────────┬');
  1708.      gotoxy (2,4);
  1709.      writeln (usr,'│ Handle       │');
  1710.      gotoxy (2,5);
  1711.      writeln (usr,'│ Password     │');
  1712.      gotoxy (2,6);
  1713.      writeln (usr,'│ Main Level   │');
  1714.      gotoxy (2,7);
  1715.      writeln (usr,'│ Xfer Level   │');
  1716.      gotoxy (2,8);
  1717.      writeln (usr,'│ G-File Level │');
  1718.      gotoxy (2,9);
  1719.      writeln (usr,'│ Xfer Points  │');
  1720.      gotoxy (2,10);
  1721.      writeln (usr,'│ Time Left    │');
  1722.      gotoxy (2,11);
  1723.      writeln (usr,'└──────────────┘');
  1724.      textbackground (1);
  1725.      textcolor (15);
  1726.      bhigh (z);
  1727.      repeat
  1728.        c:=readkey;
  1729.        c:=upcase(c);
  1730.      until c in [#77,#75,#72,#80,#27,#13,#3];
  1731.      if (c=#77) or (c=#80) then z:=z+1;
  1732.      if (c=#75) or (c=#72) then z:=z-1;
  1733.      if z=0 then z:=7;
  1734.      if z=8 then z:=1;
  1735.      if c=#27 then dd:=true;
  1736.      if c=#13 then begin
  1737.      textbackground (0);
  1738.      gotoxy(1,13);
  1739.       case z of
  1740.         1:getnewname;
  1741.         2:getnewpassword;
  1742.         3:getnewlevel;
  1743.         4:getnewudlvl;
  1744.         5:gfilez;
  1745.         6:getnewudpts;
  1746.         7:getnewtime;
  1747.        end;
  1748.      gotoxy (1,13); clreol;
  1749.      gotoxy (1,14); clreol;
  1750.      gotoxy (1,15); clreol;
  1751.      gotoxy (1,16); clreol;
  1752.      gotoxy (1,17); clreol;
  1753.      gotoxy (1,18); clreol;
  1754.      gotoxy (1,19); clreol;
  1755.      gotoxy (1,20); clreol;
  1756.      gotoxy (1,21); clreol;
  1757.      gotoxy (1,22); clreol;
  1758.      gotoxy (1,23); clreol;
  1759.      end;
  1760.      until dd=true;
  1761. end;
  1762.  
  1763. procedure externalcmds;
  1764. var c:char;
  1765.     x,y,z,a:integer;
  1766.     dir:string[127];
  1767.     DD:boolean;
  1768.  
  1769. procedure bhigh (x:integer);
  1770. var c:char;
  1771.     y,z,a:integer;
  1772.     dir:string[127];
  1773.  
  1774. begin
  1775.      case x of
  1776.        1:begin
  1777.              gotoxy (17,4);
  1778.              textcolor (15);
  1779.              textbackground (7);
  1780.              write (usr,' Run Setup    ');
  1781.          end;
  1782.        2:begin
  1783.              gotoxy (17,5);
  1784.              textcolor (15);
  1785.              textbackground (7);
  1786.              write (usr,' Text Editor  ');
  1787.          end;
  1788.        3:begin
  1789.              gotoxy (17,6);
  1790.              textcolor (15);
  1791.              textbackground (7);
  1792.              write (usr,' ANSI Editor  ');
  1793.          end;
  1794.      end;
  1795. end;
  1796.  
  1797. begin
  1798. z:=1;          dd:=false;
  1799. repeat
  1800.      gotoxy (16,3);
  1801.      textbackground (1);
  1802.      textcolor (15);
  1803.      writeln (usr,'┬──────────────┬');
  1804.      gotoxy (16,4);
  1805.      writeln (usr,'│ Run Setup    │');
  1806.      gotoxy (16,5);
  1807.      writeln (usr,'│ Text Editor  │');
  1808.      gotoxy (16,6);
  1809.      writeln (usr,'│ ANSI Editor  │');
  1810.      gotoxy (16,7);
  1811.      writeln (usr,'└──────────────┘');
  1812.      textbackground (1);
  1813.      textcolor (15);
  1814.      bhigh (z);
  1815.      repeat
  1816.        c:=readkey;
  1817.        c:=upcase(c);
  1818.      until c in [#77,#75,#72,#80,#27,#13,#3];
  1819.      if (c=#77) or (c=#80) then z:=z+1;
  1820.      if (c=#75) or (c=#72) then z:=z-1;
  1821.      if z=0 then z:=3;
  1822.      if z=4 then z:=1;
  1823.      if c=#27 then dd:=true;
  1824.      if c=#13 then begin
  1825.       textbackground (0);
  1826.       clrscr;
  1827.       case z of
  1828.         1:runconfig;
  1829.         2:dotexteditor;
  1830.         3:doansieditor;
  1831.        end;
  1832.      clrscr;
  1833.      end;
  1834.      until dd=true;
  1835. end;
  1836.  
  1837. procedure firstbar;
  1838. var c:char;
  1839.     x,y,z,a,i,ii:integer;
  1840.     dir:string[127];
  1841.     done:boolean;
  1842.  
  1843. begin
  1844. done:=false;x:=1;y:=1;z:=1;
  1845.      repeat
  1846.      textbackground (1);
  1847.      textcolor (15);
  1848.      gotoxy (1,1);
  1849.      write (usr,'┌'); for i:=2 to 79 do begin gotoxy (i,1); write (usr,'─'); end;
  1850.      write (usr,'┐');
  1851.      gotoxy (1,2);
  1852. write (usr,'│ User Editor   External   Shell to DOS   Hang Up   Delete User   Help   Quit  │');
  1853.      gotoxy (1,3);
  1854.      write (usr,'└'); for i:=2 to 79 do begin gotoxy (i,3); write (usr,'─'); end;
  1855.      write (usr,'┘');
  1856.      high (x);
  1857.      repeat until keypressed;
  1858.      repeat
  1859.        c:=readkey;
  1860.        c:=upcase(c);
  1861.      until c in [#77,#75,#13,#3,#27];
  1862.      if c=#27 then done:=true;
  1863.      if c=#77 then x:=x+1;
  1864.      if c=#75 then x:=x-1;
  1865.      if x=8 then x:=1;
  1866.      if x=0 then x:=7;
  1867.      if c=#13 then begin
  1868.       textbackground (0);
  1869.       case x of
  1870.        1:execcmds;
  1871.        2:externalcmds;
  1872.        3:gotodos;
  1873.        4:hangupyn;
  1874.        5:nuke;
  1875.        6:dohelp;
  1876.        7:done:=true;
  1877.       end;
  1878.        textbackground (0);
  1879.        clrscr;
  1880.      end;
  1881. until done;
  1882. textbackground (0);
  1883. end;
  1884.  
  1885.     begin
  1886.      cursor (false);
  1887.      clrscr;
  1888.      firstbar;
  1889.     end; {pulldownmenu}
  1890.  
  1891.   Var scom:sstr;
  1892.     k:Char;
  1893.   Begin
  1894.     writeln (^B^M'Please Wait:');
  1895.     Pulldownmenu;
  1896.     clrscr;
  1897.     cursor (true);
  1898.     specialcommand:=true;
  1899.   End;
  1900.  
  1901.  
  1902. procedure specialseries;
  1903. begin
  1904.   repeat until specialcommand
  1905. end;
  1906.  
  1907. procedure chat1 (gotospecial:boolean);
  1908. var k:char;
  1909.     time,cnt,displaywid:integer;
  1910.     quit,carrierloss,fromkbd:boolean;
  1911.     baudstr,commstr:mstr;
  1912.  
  1913.                        (*--Variable Definitions----*)
  1914.  
  1915.  
  1916.     xsys     :byte;       (*--X location of cursor for sysop--*)
  1917.     ysys     :byte;       (*--Y locaiton of cursor for sysop--*)
  1918.     xusr     :byte;       (*--X location of cursor for user---*)
  1919.     yusr     :byte;       (*--Y location of cursor for user---*)
  1920.     curcolor :byte;       (*--Stores current typists color----*)
  1921.     ec       :byte;       (*--Stores old color for speed inc--*)
  1922.     initi    :boolean;    (*--Amount of times of initia-------*)
  1923.     linebufs :string[80]; (*--Storage of what sysop types-----*)
  1924.     linebufu :string[80]; (*--Storage of what usr types-------*)
  1925.  
  1926. (*-Initialization of all the variables takes place-------------------------*)
  1927. procedure init;
  1928. begin
  1929.   xsys     :=1;
  1930.   ysys     :=4;
  1931.   xusr     :=1;
  1932.   yusr     :=14;
  1933.   curcolor :=1;
  1934.   ec       :=1;
  1935.   initi    :=true;
  1936.   linebufs :='';
  1937.   linebufu :='';
  1938. end;
  1939.  
  1940.  
  1941. (*-Sends to screen location X,Y depending on values passed as X,Y----------*)
  1942. procedure sendxy (x,y:byte);
  1943. begin
  1944.  write(#27+'[',y,';',x,'f');
  1945.  
  1946. end;
  1947.  
  1948. (*-Sets color if color is same as old, increases speed by not re-setting it*)
  1949. Procedure setc;
  1950. begin
  1951.    ec:=urec.inputcolor;
  1952.    if curcolor<>ec then begin
  1953.    curcolor:=ec;
  1954.    modeminlock:=true;
  1955.    ansicolor (curcolor);
  1956.    modeminlock:=false;
  1957.   end;
  1958. end;
  1959.  
  1960. (*-Clears entire screen via esc[2J-----------------------------------------*)
  1961. Procedure clearscre;
  1962. var i:byte;
  1963.  begin
  1964. for I:=4 to 22 do
  1965.   begin
  1966.    setc;
  1967.    sendxy(1,i);
  1968.    write(#27'[K');
  1969.   end;
  1970.  end;
  1971.  
  1972. function parsedate (date:anystr):lstr;
  1973. const months: array[1..12] of string[3]=('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  1974.  
  1975. var m,d,y,inc,gog:sstr;
  1976.     year,month,day,dayofweek:word;
  1977. begin
  1978.  if length(date)<>8 then begin
  1979.   parsedate:=date;
  1980.   exit;
  1981.  end else
  1982.  begin
  1983.   m:=copy (date,1,2);
  1984.   d:=copy (date,4,2);
  1985.   y:=copy (date,7,2);
  1986.   gog:=months[valu(m)];
  1987.   getdate (year,month,day,dayofweek);
  1988.   inc:=copy (strr(year),1,2);
  1989.   parsedate:=gog+' '+d+' '+inc+y;
  1990.  end;
  1991. end;
  1992.  
  1993. (*---Displays middle line in urec.regular color----------------------------*)
  1994.  procedure midline;
  1995.  begin
  1996.    sendxy(1,13);
  1997.    if asciigraphics in urec.config then
  1998.    write(^P'───────────────────────────────────────────────────────────────────────────────')
  1999.    else
  2000.    write(^P'-------------------------------------------------------------------------------');
  2001.    sendxy(25,13);
  2002.    write (^R'[ '^S'FAQ '+ver+^P' - '^S+parsedate(date)+^R' ]')
  2003.    {sendxy(trunc((21-length(sysopname))/2),13);
  2004.    write (^R'[ '^S+sysopname+^R' ]');
  2005.    sendxy(trunc((24-length(urec.handle))/2)+52,13);
  2006.    write (^R'[ '^S+urec.handle+^R' ]');}
  2007.  end;
  2008. (*-Procedure Clears either lines 4-13 or 14-22 depending on WHERE:boo------*)
  2009. Procedure cle (malig:byte);
  2010. var i    :byte;  (*Loop variable - no usage*)
  2011. begin
  2012. if malig=0 then
  2013. begin
  2014.   for i:=4 to 12 do
  2015.  begin
  2016.   sendxy(1,i);
  2017.   write(#27'[K');
  2018.  end;
  2019.  sendxy(1,4);
  2020.  malig:=0;
  2021.  midline;
  2022. end;  (*  lines 4-12  *)
  2023.  
  2024. if malig=1 then
  2025. begin
  2026.   for i:=14 to 22 do
  2027.  begin
  2028.   sendxy(1,i);
  2029.   write(#27,'[K');
  2030.  end;
  2031.  sendxy(1,14);
  2032.  malig:=0;
  2033.  midline;
  2034. end;  (*  lines 14-22  *)
  2035.  
  2036.  
  2037. (*NOTE:  Line 13 is taken up by the middle line *)
  2038.  
  2039. end;
  2040.  
  2041.   procedure wordwrapit(yeanea:byte);
  2042.   var cnt       :byte;
  2043.       wl        :integer;
  2044.       ww        :lstr;
  2045.       cutarea   :byte;
  2046.       done      :boolean;
  2047.   begin
  2048.    done:=false;
  2049.    cutarea:=0;
  2050.    cnt:=80;
  2051.    if yeanea=0 then
  2052.      begin
  2053.     repeat
  2054.       if not done and (copy(linebufs,cnt,1)=' ') then cutarea:=cnt;
  2055.       if (cutarea>0) and not done then
  2056.         begin
  2057.          ansicolor(urec.statcolor);
  2058.          sendxy(cutarea,ysys);
  2059.          write(#27'[K');
  2060.          inc(ysys);
  2061.          xsys:=1;
  2062.          sendxy(xsys,ysys);
  2063.          write(copy(linebufs,cutarea+1,80-cutarea));
  2064.          xsys:=length(copy(linebufs,cutarea+1,80-cutarea))+1;
  2065.          sendxy(xsys,ysys);
  2066.          dec(ysys);
  2067.          done:=true
  2068.         end;      (*If loop     *)
  2069.       dec(cnt);   (*decrements c*)
  2070.      until cnt=1; (*For CNT loop*)
  2071.     linebufs:='';
  2072.    end;           (*For YEANEA  *)
  2073.  
  2074.    if yeanea=1 then
  2075.    begin
  2076.    done:=false;
  2077.    cutarea:=0;
  2078.    cnt:=80;
  2079.     repeat
  2080.       if not done and (copy(linebufu,cnt,1)=' ') then cutarea:=cnt;
  2081.       if (cutarea>0) and not done then
  2082.         begin
  2083.          ansicolor(urec.inputcolor);
  2084.          sendxy(cutarea,yusr);
  2085.          write(#27'[K');
  2086.          inc(yusr);
  2087.          xusr:=1;
  2088.          sendxy(xusr,yusr);
  2089.          write(copy(linebufu,cutarea+1,80-cutarea));
  2090.          xusr:=length(copy(linebufu,cutarea+1,80-cutarea))+1;
  2091.          sendxy(xusr,yusr);
  2092.          dec(yusr);
  2093.          done:=true
  2094.         end;      (*If loop     *)
  2095.       dec(cnt);   (*decrements c*)
  2096.      until cnt=1; (*For CNT loop*)
  2097.     linebufu:='';
  2098.    end;           (*For YEANEA  *)
  2099.  
  2100. end;              (*For wordwrap*)
  2101.  
  2102.  
  2103. (*---Places cursor at correct position------------------------------------*)
  2104.  Procedure locate;
  2105.  begin
  2106.    if fromkbd then     (*Checks if typed by sysop*)
  2107.  begin
  2108.  
  2109.    if (xsys=80) and (ysys<12) then     (*Checks if at end of line*)
  2110.   begin
  2111.    wordwrapit(0);
  2112.    inc(ysys);
  2113.    if not ysys=13 then linebufs:='';
  2114.   end;
  2115.   if (ysys=12) and (xsys=80) then
  2116.   begin
  2117.   cle(0);
  2118.   ysys:=4;
  2119.   xsys:=1;
  2120.   sendxy(xsys,ysys);
  2121.   write(linebufs);
  2122.   sendxy(80-length(linebufs)+1,ysys);
  2123.   wordwrapit(0);
  2124.   inc(ysys);
  2125.   sendxy(xsys,ysys);
  2126.  end;
  2127.  
  2128.   sendxy(xsys,ysys);
  2129.   inc(xsys);
  2130.  end;
  2131.    if not fromkbd then     (*Checks if typed by user*)
  2132.  begin
  2133.    if (xusr=80) and (yusr<22) then     (*Checks if at end of line*)
  2134.   begin
  2135.    wordwrapit(1);
  2136.    inc(yusr);
  2137.    if not yusr=23 then linebufu:='';
  2138.   end;
  2139. if (yusr=22) and (xusr=80) then
  2140.  begin
  2141.    cle(1);
  2142.    yusr:=14;
  2143.    xusr:=1;
  2144.    sendxy(xusr,yusr);
  2145.    write(linebufu);
  2146.    sendxy(80-length(linebufu)+1,yusr);
  2147.    wordwrapit(1);
  2148.    inc(yusr);
  2149.    sendxy(xusr,yusr);
  2150.  end;
  2151.  
  2152.    sendxy(xusr,yusr);
  2153.    inc(xusr);
  2154.  end;
  2155. end;                   (*end of procedure*)
  2156.  
  2157.   procedure instruct;
  2158.   var i:integer;
  2159.   begin
  2160.  for i:=1 to 5 do
  2161.    begin
  2162.      sendxy(1,i);
  2163.      write(#27,'[K');
  2164.    end;
  2165.     {splitscreen (3);}
  2166.     top;
  2167.     clrscr;
  2168.     {write (usr,'Now in Chat mode. Press [F1] to leave or [F2] for commands.');}
  2169.     initi:=false;
  2170.     bottom;
  2171.     sendxy(1,4);
  2172.   end;
  2173.  
  2174.  
  2175.   procedure typedchar (k:char);
  2176.   begin
  2177.  
  2178.    locate;    (*  Puts cursor in right place *)
  2179.    begin;
  2180.    if fromkbd then linebufs:=linebufs+K else linebufu:=linebufu+K;
  2181.     setc;      (*  Sets up color for typing   *)
  2182.     write(k)
  2183.    end;
  2184.   end;
  2185.  
  2186. begin
  2187.   time:=timeleft;
  2188.   carrierloss:=false;
  2189.   chatmode:=false;
  2190.   writeln (^B^M);
  2191.   if wanted in urec.config then begin
  2192.     specialmsg ('No longer wanted.');
  2193.     urec.config:=urec.config-[wanted];
  2194.     writeurec;
  2195.   end;
  2196.   if eightycols in urec.config then displaywid:=80 else displaywid:=40;
  2197.   if gotospecial then begin
  2198.     specialseries;
  2199.     exit
  2200.   end;
  2201.   clearbreak;
  2202.   nobreak:=true;
  2203.   writeln (^M^S,appear);
  2204.   writeln (^R'CHAT '^S'IN '^P'['^S,upstring(Timestr(now)),^P']'^M);
  2205.   instruct;
  2206.   if not initi then
  2207. begin
  2208.    init;      (*  Sets up variables          *)
  2209.    clearscre; (*  Clears screen lines 4-22   *)
  2210.    midline;   (*  Draws middle line for chat *)
  2211. end;
  2212.  
  2213.   quit:=false;
  2214.  
  2215.   repeat
  2216.     linecount:=0;
  2217.     if (not carrierloss) and (not carrier) then begin
  2218.       carrierloss:=true;
  2219.       writeln (^M'There is no carrier present.'^M)
  2220.     end;
  2221.     repeat until keyhit or (carrier and (numchars>0));
  2222.     fromkbd:=keyhit;
  2223.     ingetstr:=true;
  2224.  
  2225.     read (directin,k);
  2226.     if k=#127 then k:=#8;
  2227.     if requestchat1
  2228.       then if requestcom
  2229.         then
  2230.           begin
  2231.             quit:=specialcommand;
  2232.             if not quit then instruct;
  2233.             clearbreak;
  2234.             nobreak:=true;
  2235.           end
  2236.         else
  2237.           begin
  2238.             unsplit;
  2239.             clearscre;
  2240.             writeln (^M^S,disappear);
  2241.             writeln (^R'CHAT '^S'OUT '^P'['^S,upstring(Timestr(now)),^P']'^M^R);
  2242.             quit:=true
  2243.           end;
  2244.     case ord(k) of
  2245.       8:begin
  2246.       if (xsys>0) and fromkbd then
  2247.        begin
  2248.           modeminlock:=true;
  2249.           dec(xsys);
  2250.           sendxy(xsys,ysys);
  2251.           write (' ');
  2252.           sendxy(xsys,ysys);
  2253.           linebufs:=copy(linebufs,1,length(linebufs)-1);
  2254.           modeminlock:=false;
  2255.         end;
  2256.       if (xusr>0) and not fromkbd then
  2257.        begin
  2258.           modeminlock:=true;
  2259.           dec(xusr);
  2260.           sendxy(xusr,yusr);
  2261.           write (' ');
  2262.           sendxy(xsys,ysys);
  2263.           linebufu:=copy(linebufu,1,length(linebufu)-1);
  2264.           modeminlock:=false;
  2265.         end;
  2266.      end;
  2267.       0:;
  2268.       13:begin
  2269.            writeln;
  2270.            bottomline;
  2271.           if fromkbd then begin
  2272.            xsys:=1;
  2273.            inc(ysys);
  2274.              if (ysys=13) and (xusr>-1) then    (*Checks if at end of row *)
  2275.               begin
  2276.                  cle(0);
  2277.                   setc;
  2278.                   ysys:=4;
  2279.                   xsys:=1;
  2280.                   sendxy(xsys,ysys);
  2281.                   write(linebufs);
  2282.                   ysys:=5;
  2283.                   sendxy(xsys,ysys);
  2284.                   setc;
  2285.               end;
  2286.           sendxy(xsys,ysys);
  2287.           linebufs:='';
  2288.           end;
  2289.  
  2290.           if not fromkbd then begin
  2291.            xusr:=1;
  2292.            inc(yusr);
  2293.              if (yusr=23) and (xusr>-1) then    (*Checks if at end of row *)
  2294.               begin
  2295.                  cle(1);
  2296.                   setc;
  2297.                   yusr:=14;
  2298.                   xusr:=1;
  2299.                   sendxy(xusr,yusr);
  2300.                   write(linebufu);
  2301.                   yusr:=15;
  2302.                   sendxy(xusr,yusr);
  2303.                   setc;
  2304.               end;
  2305.             sendxy(xusr,yusr);
  2306.           linebufu:='';
  2307.           end;
  2308.          end;
  2309.       32..126:typedchar (k);
  2310.       1..31:if fromkbd and carrier then sendchar(k)
  2311.     end
  2312.   until quit;
  2313.   clearbreak;
  2314.   settimeleft (time)
  2315. end;
  2316.  
  2317. procedure chat2 (gotospecial:boolean);
  2318. var k:char;
  2319.     time,cnt,displaywid:integer;
  2320.     quit,carrierloss,fromkbd:boolean;
  2321.     linebuffer:lstr;
  2322.     l:byte absolute linebuffer;
  2323.     curcolor:byte;
  2324.     baudstr,commstr:mstr;
  2325.  
  2326.   procedure instruct;
  2327.   begin
  2328.    {splitscreen (3);}
  2329.     top;
  2330.     clrscr;
  2331.     {write (usr,'Now in Chat mode. Press [F1] to leave or [F2] for commands.');}
  2332.     bottom
  2333.   end;
  2334.  
  2335.   procedure wordwrap;
  2336.   var cnt,wl:integer;
  2337.       ww:lstr;
  2338.   begin
  2339.     ww:='';
  2340.     cnt:=displaywid;
  2341.     while (cnt>0) and (linebuffer[cnt]<>' ') do cnt:=cnt-1;
  2342.     if cnt=0 then ww:=k else begin
  2343.       ww:=copy(linebuffer,cnt+1,255);
  2344.       wl:=length(ww)-1;
  2345.       if wl>0 then begin
  2346.         for cnt:=1 to wl do write (^H);
  2347.         for cnt:=1 to wl do write (' ')
  2348.       end
  2349.     end;
  2350.     writeln;
  2351.     ansicolor (curcolor);
  2352.     write (ww);
  2353.     linebuffer:=ww
  2354.   end;
  2355.  
  2356.   procedure typedchar (k:char);
  2357.   var ec:byte;
  2358.   begin
  2359.     l:=l+1;
  2360.     linebuffer[l]:=k;
  2361.     if fromkbd then ec:=urec.regularcolor else ec:=urec.inputcolor;
  2362.     if curcolor<>ec then begin
  2363.       curcolor:=ec;
  2364.       ansicolor (curcolor)
  2365.     end;
  2366.     if l=displaywid then wordwrap else write(k)
  2367.   end;
  2368.  
  2369. begin
  2370.   time:=timeleft;
  2371.   carrierloss:=false;
  2372.   chatmode:=false;
  2373.   writeln (^B^M);
  2374.   if wanted in urec.config then begin
  2375.     specialmsg ('No longer wanted.');
  2376.     urec.config:=urec.config-[wanted];
  2377.     writeurec;
  2378.   end;
  2379.   if eightycols in urec.config then displaywid:=80 else displaywid:=40;
  2380.   if length(chatreason)>0 then specialmsg ('[Chat Reason: '+chatreason+']');
  2381.   chatreason:='';
  2382.   if gotospecial then begin
  2383.     specialseries;
  2384.     exit
  2385.   end;
  2386.   clearbreak;
  2387.   nobreak:=true;
  2388.   writeln (^M^S,appear);
  2389.   writeln (^R'CHAT '^S'IN '^P'['^S,upstring(Timestr(now)),^P']'^M^R);
  2390.   instruct;
  2391.   quit:=false;
  2392.   l:=0;
  2393.   curcolor:=urec.regularcolor;
  2394.   repeat
  2395.     linecount:=0;
  2396.     if (not carrierloss) and (not carrier) then begin
  2397.       carrierloss:=true;
  2398.       writeln (^M'There is no carrier present.'^M)
  2399.     end;
  2400.     repeat until keyhit or (carrier and (numchars>0));
  2401.     fromkbd:=keyhit;
  2402.     ingetstr:=true;
  2403.     read (directin,k);
  2404.     if k=#127 then k:=#8;
  2405.     if requestchat2
  2406.       then if requestcom
  2407.         then
  2408.           begin
  2409.             quit:=specialcommand;
  2410.             if not quit then instruct;
  2411.             clearbreak;
  2412.             nobreak:=true;
  2413.             l:=0
  2414.           end
  2415.         else
  2416.           begin
  2417.             unsplit;
  2418.             writeln (^M^S,disappear);
  2419.             writeln (^R'CHAT '^S'OUT '^P'['^S,upstring(Timestr(now)),^P']'^M);
  2420.             quit:=true
  2421.           end;
  2422.     case ord(k) of
  2423.       8:if l>0 then begin
  2424.           write (k+' '+k);
  2425.           l:=l-1
  2426.         end;
  2427.       0:;
  2428.       13:begin
  2429.            writeln;
  2430.            bottomline;
  2431.            l:=0
  2432.          end;
  2433.       32..126:typedchar (k);
  2434.       1..31:if fromkbd and carrier then sendchar(k)
  2435.     end
  2436.   until quit;
  2437.   clearbreak;
  2438.   settimeleft (time)
  2439. end;
  2440.  
  2441. begin
  2442. end.
  2443.